<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>系统管理--组织结构管理</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" href="css/chuchu/chuchu.css" type="text/css"></link>
    <link rel="stylesheet" href="easyui/themes/icon.css" type="text/css"></link>
	 <link rel="stylesheet" href="easyui/themes/default/easyui.css" type="text/css"></link>
	 <script type="text/javascript" src="easyui/jquery-1.8.3.js"></script>
	 <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
  		$(function(){
  		$("#bt").click(function(){
  			$("#div5").dialog("open");
  		});
  		
  		$("#div5").dialog({
  			title:"选择负责人",
  			width:200,
  			closed:true
  		});
  				$.post(
					"users/find.do",
					function(data){
						var str="";
						for(i=0;i<data.length;i++){
							str+="&nbsp&nbsp&nbsp&nbsp<input onclick='cl("+data[i].id+")' name='"+data[i].id+"' type='button' value='"+data[i].name+"' class='btnn'/><br>";
						}
						$("#div4").html(str);
					},
					"json"  				
  				);
  			$("#btn").click(function(){
  			var data = "deptname="+$("#deptname").val()+
  			"&deptmanagerid="+$("#deptmanagerid").val()+
  			"&phone="+$("#phone").val()+
  			"&telephone="+$("#telephone").val()+
  			"&fax="+$("#fax").val()+
  			"&id="+$("#deptid").val();
  				$.post(
					"dept/update.do",
					data,
					function(data){
						alert(data);
					},
					"text"  				
  				);
  			});
  		});
  		function cl(data1){
  			data="id="+data1;
  			$.post("users/findByIdd.do",
  			data,
			function(data){
				$("#deptmanagername").val(data.name);
				$("#deptmanagerid").val(data.id);
			},"json");
  		}
  	</script>
  </head>
  
  <body>
	<div id="mainbody">
        <p><img src="css/chuchu/img/icons/posts.png"/>&nbsp;&nbsp;<span>系统设置</span></p>
	    <div class="title">
	        	组织机构管理
	    </div>
	    <div class="content">
        	
        	<table cellpadding="0" cellspacing="0">
               <tr >
               		<td>部门名称：</td>
                    <td><input id="deptname" type="text" value="${dept.deptname }"/></td>
               </tr>
               <tr >
                	<td>所属机构：</td>
                    <td>北大青鸟中博学院</td>
               </tr>
               <tr>
	               <td>部门负责人：</td>
	               <td><input id="deptmanagerid" type="hidden"/><input id="deptmanagername" type="text"/> <input id="bt" type="button" value="选择" class="button"/>（点击选择负责人）</td>
               </tr>  
               <tr >
                	<td>联系电话：</td>
                    <td><input id="phone" type="text" value="${dept.phone }"/></td>
               </tr>
               <tr >
                	<td>移动电话：</td>
                    <td><input id="telephone" type="text" value="${dept.telephone }"/></td>
               </tr>
               <tr >
                	<td>传真：</td>
                    <td><input id="fax" type="text" value="${dept.fax }"/></td>
               </tr> 
               <tr >
                	<td><input id="btn" class="button" type="button" value="保存"/></td>
                    <td><input class="button" type="button" value="取消"/></td>
               </tr> 
               
                 
            </table>
                
        </div> 
         <input type="hidden" value="${dept.id}" id="deptid"/>
                
    </div>
    <div id="div5">
   	 <div id="div4">
	    
   	 </div>
	</div>	
 </body>
</html>
